package com.gitee.kamismile.stone.basic.data.infrastructure.repository.r2Repository.sysdic.repository;

import com.gitee.kamismile.stone.basic.data.application.rep.DictionaryDefineRep;
import com.gitee.kamismile.stone.basic.data.domain.sysdic.repository.entity.SysDictionaryDefine;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import reactor.core.publisher.Flux;

import java.util.List;

public interface SysDictionaryDefineRepository extends R2dbcRepository<SysDictionaryDefine,Long> {

    @Query("select sdd.*,sd.s_alias,sd.s_name,sd.n_group from sys_dictionary_define sdd" +
            " inner join sys_dictionary sd on sdd.n_sys_dictionary_id=sd.n_sys_dictionary_id" +
            " where sd.n_tenant_id=sdd.n_tenant_id and sdd.n_state>0 and sd.n_tenant_id in (0,:nTenantId)  and sd.s_alias in (:alias) order by  sd.n_sys_dictionary_id")
    Flux<DictionaryDefineRep> findDicDefineAllByAlias(List<String> alias, Integer nTenantId);
}
